package com.wanxi.web.controller;


import com.wanxi.shop.api.query.NearShopQuery;
import com.wanxi.shop.api.result.CommonResult;
import com.wanxi.shop.api.vo.ShopUpdateInVo;
import com.wanxi.web.service.shop.ShopSelfWebService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Api(tags = "商家自我管理")
public class ShopSelfController {

    @Resource
    private ShopSelfWebService service;


    /**
     * @author jinfang
     * @description // 店家根据id查看自己的店铺信息
     * @date  2021/1/18
     * @params id
     * @return CommonResult
     **/
    @GetMapping("shop/findShopById")
    public CommonResult shopFindShopById(Long id){
        return service.shopFindShopById(id);
    }

    /**
     * @author jinfang
     * @description 店家根据id修改自己的店铺信息
     * @date  2021/1/18
     * @params shopUpdateInVo
     * @return CommonResult
     **/
    @PutMapping("shop/updateShopById")
    public CommonResult shopUpdateShop(ShopUpdateInVo shopUpdateInVo){
        return service.shopUpdateShop(shopUpdateInVo);
    }

    /**
     * @author jinfang
     * @description 用户查询自己几公里范围内的店铺
     * @date  2021/1/15
     * @param nearShopQuery
     * @return
     */
    @GetMapping("user/findNearShop")
    public CommonResult findNearShop(NearShopQuery nearShopQuery){
        return service.findNearShop(nearShopQuery);
    }
}
